package com.youbug;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;

@SpringBootApplication
@EnableScheduling
public class Application {

	@Value("${spring.application.name}")
	public static String applicationName;

	public static String DEFAULT_APPLICATION_NAME = "system";

	public static List<String> systemList = new ArrayList<>();

	public static String getSaveSystemName(){

		if(applicationName != null){
			return applicationName;
		}
		return DEFAULT_APPLICATION_NAME;
	}

	public static List<String> getSystemNameList(){

		if(DEFAULT_APPLICATION_NAME.equals(applicationName)){
			systemList.add(DEFAULT_APPLICATION_NAME);
			return systemList;
		}
		systemList.add(DEFAULT_APPLICATION_NAME);
		systemList.add(applicationName);
		return systemList;
	}

	public static void main(String[] args) {
		TimeZone timeZone = TimeZone.getTimeZone("UTC+8");
		TimeZone.setDefault(timeZone);
		SpringApplication.run(Application.class, args);
	}
}
